<template>
	<view class="">
		<view class="between align-c" v-for="(v,i) in list" :key="i">
			<view class="flex align-c">
				<image v-if="v&&v.user&&v.user.avator" :src="$img(v.user.avator)" mode="aspectFill" class="teacher_img" />
				<image v-else src="/static/head.png" mode="aspectFill" class="teacher_img" />
				<view class="teacher_name" v-if="v&&v.user&&v.user.name">{{ v.user.name }}</view>
				<view class="teacher_name" v-else>暂无用户名</view>
			</view>
			<view class="teacher_time" v-if="v&&v.updated_at">{{ v.updated_at }}</view>
		</view>
	</view>
</template>

<script>
import { type } from 'os'
	export default {
		data() {
			return {
				keyword: '',
				showAction: false,
				id: '',
				type: '',
				list: [],
				page: 1,
				last_page: 1,
			}
		},
		onLoad(opt) {
			this.type = opt.type;
			this.id = opt.id;
		},
		onShow() {
			this.getList();
		},
		methods: {
			async getList() {
				let res = await this.$api.get(`staff/table/${this.type==1 ?'course':'private'}/detail/${this.id}`,{
					page: this.page,
				});
				if(res.code == 200) {
					this.last_page = parseInt(res.data.to)/parseInt(res.data.per_page);
					if(this.page == 1) {
						this.list = res.data.data;
					}else{
						this.list.push(...res.data.data);
					}
				}
			}
		}
	}
</script>

<style>
	page {
		background-color: #F7F7F7;
	}
</style>

<style lang="scss" scoped>
	.between {
		padding: 0 33rpx;
		height: 120rpx;
		line-height: 120rpx;
		border-bottom: 1rpx solid #F5F5F5;
		background-color: #FFF;
	}
	.teacher_img {
		width: 73rpx;
		height: 73rpx;
		border-radius: 50%;
		margin-right: 26rpx;
	}
	.teacher_name {
		font-size: 27rpx;
	}
	.teacher_time {
		color: #B3B3B3;
		font-size: 24rpx;
	}
	.between:first-child {
		margin-top: 20rpx;
	}
</style>